package com.zhouchb.kafkaspring_boot.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * @Create 2023-05-03 20:07
 * @Description
 */
@RestController
public class KafkaProducerController {

    @Resource
    private KafkaTemplate template;
//生产者
    @GetMapping("/kafka")
    public String sendData(@RequestParam("msg") String msg){
        template.send("first",msg);
        return "ok";
    }
}
